#ifndef ENGINE_H
#define ENGINE_H

#include <QObject>
#include <QList>
#include <QVariant>
#include <mapsearchnode.h>

class Engine : public QObject
{
    Q_OBJECT
    Q_PROPERTY(bool searching READ searching NOTIFY searchingChanged)
public:
    explicit Engine(QObject *parent = 0);
    Q_INVOKABLE QVariant findPath(QVariant map, int rowCount, int ColumnCount,
                                int startRow, int startColumn,
                                int endRow, int endColumn);
    bool searching();

    int nodeValue(int row, int column);

    bool neighborNodes(const AStarSearchNode& currentNode,
                       QList<AStarSearchNode*>& neighbors);

signals:
    void searchingChanged();

public slots:

private:
    int index(int row, int column);

private:
    QList<QVariant> m_map;
    int m_row_count;
    int m_column_count;
    bool m_search_ongoing;
};

#endif // ENGINE_H
